package com.atguigu.eduservice.client;

import com.atguigu.commonutils.R;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * Feign服务调用
 * name属性被调用方服务名称
 * fallback属性执行Hystrix熔断实现类
 */
@FeignClient(name = "service-vod",fallback = VodFileDegradeFeignClient.class)
@Component
public interface VodClient {

    /**
     * 调用service-vod服务上传视频
     * @param file
     * @return
     */
    @PostMapping("/vod/video/uploadVideo")
    public R uploadVideo(MultipartFile file);

    /**
     * 调用service-vod里的删除阿里云视频
     * @param videoId
     * @return
     */
    @DeleteMapping("/vod/video/deleteVideo/{videoId}") //service-vod服务里的方法路径
    public R deleteVideo(@ApiParam(value = "视频id",name = "videoId",required = true)@PathVariable String videoId);

    /**
     * 根据视频id集合批量删除视频
     * @param videoIdList
     * @return
     */
    @DeleteMapping("/vod/video/delete-batch")
    public R deleteVideoList(@RequestParam("videoIdList") List<String> videoIdList);
}
